﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace AdatbazisProjekt
{
    public partial class LoginForm : Form
    {
        private bool Err;
        public LoginForm log;

        public LoginForm()
        {
            InitializeComponent();
        }

        private void LoginForm_Load(object sender, EventArgs e)
        {
            log =this;
        }

        private void LoginButton_Click(object sender, EventArgs e)
        {

            UserData datacontrol = new UserData(ref Err);
            if (Err)
            {
                MessageBox.Show("Hiba tortent a kapcsolodas kozben!");
            }
            int naMizu = datacontrol.GetUserByUserName(usernameTB.Text.ToString(), passwordTB.Text.ToString());
            if (naMizu < 0)
            {
                MessageBox.Show("Hibas Jelszo!!");
            }
            else
            {
              
                Controller.Usertype = naMizu;
            }

            FMenu fuck = new FMenu();
            fuck.Show();
            log.Hide();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
    }
}
